#ifndef _QGCM_NETCDFAUX_
#define _QGCM_NETCDFAUX_

#include <stdlib.h>
#include <vector>
#include "datatypes.h"
#include "model.h"
#include "static.h"
#include "qgcmio.h"

#ifdef __QGCMDOUBLEPRECISION
#define ncREAL ncDouble
#else
#define ncREAL ncFloat
#endif


const REAL & getsetmissing_val(REAL, bool);

double nc_static_open(model_class &, nchandler &, const char *, bool open, bool overwrite);
NcVar * ncgetaddvar(NcFile *, const char *, NcType, int, const NcDim **);

bool nc_write_static_coeffs(model_class &,
		const char * filename,
		bool overwrite,
		const static_container * Rs, const static_container * Ss, 
		const map_container<REAL, 6> * Amap,
		const map_container<REAL, 3> * Qmap,
		const map_container<REAL, 3> * QImap);


bool read_static_data(nchandler & nc_container, const double & nchandle, 
		static_container & Rs, static_container & Ss, map_container<REAL,6> & Acoeffs,
		map_container<REAL,3> &  Qcoeffs, map_container<REAL,3> & QIcoeffs);

bool read_static_data(nchandler & nc_container, const double & nchandle, 
		map_container<REAL,3> &  Qcoeffs, map_container<REAL,3> & QIcoeffs);

bool open_static_coeffs_file(model_class & mo, nchandler & nc_container, double & nchandle, const char * filename);

bool does_dim_exist(NcFile *, const char * );

#endif
